#include <stdio.h>

#include "control.h"

//头插法
struct control *add_interface_to_ctrl_list(struct control *phead, struct control *control_interface)
{
    struct control *pcontrol;

    //检查链表是否为空
    if(NULL == phead){
        //链表为空，将新接口（节点）作为链表的第一个节点（头节点）
        pcontrol = control_interface;
        return pcontrol;
    }else{
        //链表不为空，使用头插法将新接口插入到链表头部
        control_interface->next = phead;    //新节点指向原来的头节点
        phead = control_interface;          //更新头指针为新节点
        return phead;
    }
}